<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class MenuRequest extends FormRequest
{

    public function rules(): array
    {
        return [
            'parentId'       => 'required|integer',
            'name'           => 'required|string|max:100',
            'type'           => 'required|in:1,2,3,4',
            'routeName'      => 'nullable|string',
            'routePath'      => 'nullable|string',
            'component'      => 'nullable|string',
            'visible'        => 'nullable|in:0,1',
            'icon'           => 'nullable|string|max:100',
            'sort'           => 'nullable|integer',
            'redirect'       => 'nullable|string|max:200',
            'perm'           => 'nullable|string|max:100',
            'keepAlive'      => 'nullable|in:0,1',
            'alwaysShow'     => 'nullable|in:0,1',
            'params'         => 'nullable|array',
            'params.*.value' => 'required|string',
            'params.*.key'   => 'required|string'
        ];
    }
}
